<template>
  <div class="">
    <header class="header">
      <h1>todos</h1>
      <input
        class="new-todo"
        placeholder="请输入任务名称"
        autofocus
        v-model="literals"
        @keyup.enter="importation(literals)"
      />
    </header>
  </div>
</template>
<script>
export default {
  name: 'ToHeader',
  props: {
    list: {
      type: Array
    }
  },
  data () {
    return {
      literals: ''
    }
  },
  methods: {
    importation (literals) {
      if (literals) {
        this.$emit('importation', literals)
        this.literals = ''
      }
    }
  }
}
</script>
<style lang="less" scoped></style>
